
import cache from "@/common/cache.js";
export default {
	verify(){
		const timestamp = new Date().getTime();//现在时间戳
		const l = 1000 * 3600 * 24 * 7;
		let user = uni.getStorageSync("user");
		if(user){
			console.log(user);
			if(!user.loginTime || timestamp > (user.loginTime + l)){
				uni.showModal({
					title: "提示",
					content: "您还未登录，请先登录~",
					confirmText: "去登录",
					cancelText: "再逛会",
					success: (res) => {
						if (res.confirm) {
							uni.navigateTo({
								url: '/pages/login/login'
							});
						}else{
							uni.navigateTo({
								url: '/pages/login/login'
							});
						}
					}
				})
			}
		}else{
			uni.showModal({
				title: "提示",
				content: "您还未登录，请先登录~",
				confirmText: "去登录",
				cancelText: "再逛会",
				success: (res) => {
					if (res.confirm) {
						uni.navigateTo({
							url: '/pages/login/login'
						});
					}else{
						uni.navigateTo({
							url: '/pages/login/login'
						});
					}
				}
			})
		}
	}
	
}